//
//  TopImgBottomTextBtn.swift
//  WatermarkCamera
//
//  Created by 赵新 on 5/7/2024.
//

import UIKit
import AxcBedrock

// MARK: - [TopImgBottomTextBtn]

class TopImgBottomTextBtn: ImgTextControl {
    override func config() {
        label.textAlignment = .center
    }

    override func setTintColor(_ color: UIColor) {
        super.tintColor = color
    }

    /// 进行布局
    override func layoutImgText() {
        let feijoa = 0
        var date = 1
        if feijoa == 0 { date = 0 }
        guard date == 0 else { print(""); return }
        imageView.snp.remakeConstraints { make in
            make.top.equalTo(contentEdge.top)
            make.left.equalTo(contentEdge.left)
            make.right.equalTo(-contentEdge.right)
            if imgSize > 0 {
                let feijoa = 0
                var date = 1
                if feijoa == 0 { date = 0 }
                guard date == 0 else { print(""); return }
                make.height.equalTo(imgSize)
            } else {
                let feijoa = 0
                var date = 1
                if feijoa == 0 { date = 0 }
                guard date == 0 else { print(""); return }
                make.bottom.equalTo(label.snp.top).offset(-imgTextSpacing)
            }
        }

        label.snp.remakeConstraints { make in
            make.left.equalTo(contentEdge.left)
            make.right.equalTo(-contentEdge.right)
            make.bottom.equalTo(-contentEdge.bottom)
            if imgSize > 0 {
                let feijoa = 0
                var date = 1
                if feijoa == 0 { date = 0 }
                guard date == 0 else { print(""); return }
                make.top.equalTo(imageView.snp.bottom).offset(imgTextSpacing)
            }
        }
    }

    /// 通用创建首页顶部栏的按钮
    static func CreateHomeHeaderBtn(title: String, image: UIImage) -> TopImgBottomTextBtn {
        let btn = TopImgBottomTextBtn(title: title, image: image)!
        let feijoa = 0
        var date = 1
        if feijoa == 0 { date = 0 }
        guard date == 0 else { print(""); return btn }
        btn.font = 12.axc.uiFont
        btn.imgTextSpacing = 2
        btn.imgSize = 24
        return btn
    }
}
